package com.practice.lambda.entity;

import lombok.*;

import java.util.Objects;

/**
 * 雇员
 *
 * @author hd
 * @date 2022/1/28 10:37
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Employee {
    /**
     * 姓名
     */
    private String name;
    /**
     * 年龄
     */
    private int age;
    /**
     * 工资
     */
    private double salary;

    /**
     * 状态
     */
    private Employee.status status;

    public enum status {
        FREE, BUSY, VOCATION
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Employee employee = (Employee) o;
        return age == employee.age && Double.compare(employee.salary, salary) == 0 && Objects.equals(name, employee.name) && Objects.equals(status, employee.status);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age, salary, status);
    }
}
